package com.tarena.test.lbs.basic.threadlocal.mvc;

import com.tarena.test.lbs.basic.threadlocal.utils.NameThreadLocal;

//filter类模拟过滤器
public class MyFilter {
    private MyDispatcherServlet servlet = new MyDispatcherServlet();
    public void doFilter(){
        System.out.println("过滤器开始过滤");
        //过滤器逻辑执行完生成了一个数据 String name
        String name = "刘首富";
        //将数据保存到ThreadLocal中 key值是当前线程 value是name
        NameThreadLocal.save(name);
        servlet.doDispatch();

    }
}
